import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;

public class A1 {
    public static void main(String[] args) throws FileNotFoundException {
        //读取的是模块下的配置文件
        FileInputStream is1 = new FileInputStream("druid.properties");
        //读取类路径下的文件
        InputStream is2=A1.class.getResourceAsStream("/druid.properties"); //这个其实用的也是下边那个
        //通过当前类加载器读取配置文件（不用加杠）
        InputStream is3=A1.class.getClassLoader().getResourceAsStream("druid.properties");
        //通过系统类加载器读取配置文件（在普通项目中获取是可以的,但是在web项目中就不可以了 因为打破了双亲委派机制）
        InputStream  is4 = ClassLoader.getSystemClassLoader().getResourceAsStream("jdbc.properties");

        //https://blog.csdn.net/Memory_2020/article/details/123958303
        //https://blog.csdn.net/qq_32661351/article/details/107843220?spm=1001.2101.3001.6650.6&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-6-107843220-blog-123958303.pc_relevant_multi_platform_whitelistv1&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-6-107843220-blog-123958303.pc_relevant_multi_platform_whitelistv1&utm_relevant_index=8
        //https://www.it610.com/article/4835648.htm
    }
}
